<?php
//by willson 105328468@qq.com 2014/10/11
//index page interface

class ad_model extends base_model {

	public function __construct() {
		parent::__construct();
	}

	//获取详情
	public function detail($id) {
		$str = '-';
		$sql = "SELECT * FROM jf_ad WHERE id='{$id}'";
		$row = $this->db->get_row($sql);
		return $row;
	}

	public function types() {
		$type = array("html5"=>"网页(HTML5)", 
			"recharge"=>"充值(recharge)",
			"type"=>"一级分类(type)",
			"subtype"=>"二级分类(subtype)",
			// "brand"=>"品牌(brand)",
			// "country"=>"国家馆(country)",
			"goods"=>"商品(goods)",
			// "shop"=>"门店(shop)",
			"coupon"=>"优惠劵(coupon)",
			"article"=>"文章(article)",
			);
		return $type;
	}


	public function type_name($type) {
		$type_arr = $this->types();
		if (array_key_exists($type, $type_arr)) {
			return $type_arr[$type];
		} else {
			return "";
		}
	}
	public function positions() {
		$position = array("flash"=>"flash(轮播图)", 
			"hwjx"=>"hwjx(海外精选)",
			"yxjp"=>"yxjp(优选精品)",
			"faxian"=>"faxian(发现)",
			);
		return $position;
	}
	public function position_name($position) {
		$position_arr = $this->positions();
		if (array_key_exists($position, $position_arr)) {
			return $position_arr[$position];
		} else {
			return "";
		}
	}
}
